package shopping

import "fmt"

type fruit struct {
	Name  string  `json:"name"`
	Price float64 `json:"price"`
}

var fruit_info = make(map[string]fruit)

func Commodity_info() {
	//商品信息
	fruit_info["F001"] = fruit{Name: "苹果", Price: 6}
	fruit_info["F002"] = fruit{Name: "香蕉", Price: 5}
	fruit_info["F003"] = fruit{Name: "西瓜", Price: 10}
	fruit_info["F004"] = fruit{Name: "菠萝", Price: 3}

	//展示所有商品信息
	fmt.Println("展示商品")
	for code, fruit := range fruit_info {
		fmt.Printf("商品编号:%s, 商品名称:%s, 价格:%.2f元\n", code, fruit.Name, fruit.Price)
	}
	return
}
